﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace YDT.Payment.Application
{
    /// <summary>
    /// web支付外观
    /// </summary>
    public class WebPagePayFacade
    {
        private readonly WebPagePayFactory _webPagePayFactory;

        public WebPagePayFacade(WebPagePayFactory webPagePayFactory)
        {
            _webPagePayFactory = webPagePayFactory;
        }

        /// <summary>
        ///  统一支付
        /// </summary>
        /// <param name="PaymentType"></param>
        /// <param name="productName"></param>
        /// <param name="orderSn"></param>
        /// <param name="totalPrice"></param>
        /// <returns></returns>
        public WebPagePayResult CreatePay(string PaymentType,string productName, string orderSn, string totalPrice) {
            // 1、支付选择
            IWebPagePay webPagePay = _webPagePayFactory.GetWebPagePay(PaymentType);

            // 2、创建支付
            WebPagePayResult result = webPagePay.CreatePay(productName, orderSn, totalPrice);
            return result;
        }
    }
}
